home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Personal Computer World 2009 February
/
PCWFEB09.iso
/
Software
/
Resources
/
Chat & Communication
/
Digsby build 37
/
digsby_setup.exe
/
lib
/
tests
/
testapp.pyo
(
.txt
)
< prev
Wrap
Python Compiled Bytecode
|
2008-10-13
|
4KB
|
116 lines
# Source Generated with Decompyle++
# File: in.pyo (Python 2.5)
import sys
import wx
import digsbysite
import logextensions
from util import Storage, Delegate
def discover_res_dir():
path = path
import path
p = path('.').abspath()
if _isdigsbyroot(p):
return p
p2 = p.parent
while p != p2:
if _isdigsbyroot(p2):
return p2
p = p2
p2 = p2.parent
raise Exception('could not find res dir')
def _isdigsbyroot(p):
return (p / 'res' / 'skins' / 'default').isdir()
def testapp(pypath = None, appname = 'Digsby', skinname = 'default', prefs = None, username = 'megazord', on_message = (lambda message: pass)):
import sys as sys
import gettext as gettext
import os.path as os
gettext.install(appname, unicode = True)
app = wx.PySimpleApp()
app.SetAppName(appname)
skin = skin
import gui
setuplogging = setuplogging
import gui.toolbox
setuplogging()
init_wx = init_wx
import stdpaths
init_wx()
wx.Log.SetActiveTarget(wx.LogStderr())
app.PreShutdown = Delegate()
if pypath is None:
pypath = discover_res_dir()
skin.skininit(os.path.join(pypath, 'res'), skinname = skinname)
sys.path.insert(0, pypath)
Storage = Storage
import util
flatten = flatten
import prefs.prefsdata
import syck as syck
ObservableDict = ObservableDict
import util.observe
prefs_path = os.path.join(pypath, 'res', 'defaults.yaml')
prefs = None if prefs is not None else ObservableDict()
prefs.update({
'appearance.skin': skinname,
'appearance.variant': None })
ObservableDict = ObservableDict
import util.observe
sys.modules['digsbyprofile'] = Storage()
import digsbyprofile
digsbyprofile.profile = Storage(name = username, username = username, prefs = prefs, on_message = on_message)
f = file(prefs_path)
defaults = Storage(flatten(syck.load(f)))
f.close()
user = ObservableDict(defaults)
import common as common
common.setfakeprefs(user)
def toggle_prefs(user = user, defaults = defaults):
import prefs
prefs.edit(user, defaults, None)
def toggle_crust(app = app):
if not getattr(app, 'crust', None):
import gui as gui
wins = wx.GetTopLevelWindows()
parent = None if wins else None
app.crust = gui.PyCrustFrame(None)
if parent is not None:
parent.crust = app.crust
app.crust.Bind((wx.EVT_CLOSE,), (lambda evt: app.Exit()))
app.crust.toggle_shown()
if app.crust.IsShown():
app.crust.crust.SetFocus()
def on_key(e):
code = e.GetKeyCode()
if code == wx.WXK_F11:
toggle_prefs()
elif code == wx.WXK_F12:
toggle_crust()
elif code == wx.WXK_F5:
skin = skin
import gui
skin.reload()
else:
e.Skip()
app.Bind(wx.EVT_KEY_DOWN, on_key)
app.toggle_crust = toggle_crust
return app